<?php
require_once($_SERVER["DOCUMENT_ROOT"] . '/../boberstroi_start.php');//Подключаем файл инициализации

$adminPage = true;
$idObject = intval($_GET['idObject']);
$arrObject = Object::getObject($idObject);
$arrImages = Gallery::getEssenceImages(1, $idObject);

$arrCrumb[0][0] = View_Object::getTypeName($arrObject['type']);
$arrCrumb[0][1] = View_Object::getUrlNameByType($arrObject['type']);
$arrCrumb[1][0] = $arrObject['name'];
$arrCrumb[1][1] = 'object/'. $arrObject['ID_object'];
$arrCrumb[2][0] = 'Фотографии';

$headTitle = View_Crumb::displayTitleCrumb($arrCrumb);
$head = View_Crumb::displayCrumb($arrCrumb);

$headJS = '<script type="text/javascript" src="' . W_JS . 'ajaxupload.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'yoxview/yoxview-init.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'gallery.js"></script>';

include(TEMPLATE . 'mainHead.php');//подключаем основные части стриницы
View_Gallery::showThumb($arrImages, 1, $idObject, true);
echo '<div id="upload_button">Загрузить изображение</div>';

?>
<script type="text/javascript">
	$(document).ready(function () {
		$(".yoxview").yoxview({backgroundColor: 'black', backgroundOpacity: '0.8', lang: 'ru', playDelay: 2000})
		new AjaxUpload('upload_button', {
			action: W_AJAX + 'gallery/upload.php', 
						
			data: {
		    idObject : <?php echo $idObject ?>
		  },
			
			onSubmit : function(file , ext){
	      $('#upload_button').hide();
			},
			
			onComplete: function(file, response){
				if(response){
					//alert(response);
		      		$('#upload_button').show();
				}
				else
					location.reload();
			}
			
		});
	});
</script>
<?php
include(TEMPLATE . 'mainBottom.php');//закрываем основные части страницы
?>